import PyPDF2

pdfFileObj = open('D:\\aaa.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
print(pdfReader.numPages)

pageObj = pdfReader.getPage(0)
print(pageObj.extractText())

pdfWriter = PyPDF2.PdfFileWriter()
pdfWriter.addPage(pageObj)
with open('D:\\bbb.pdf','wb') as fh:
    pdfWriter.write(fh)